// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import iView from 'iview'
import VueQuillEditor from 'vue-quill-editor'
import axios from 'axios'
import VueAxios from 'vue-axios'

//elementnt
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-default/index.css'


import 'iview/dist/styles/iview.css'
import './common/css/common.css'
//import './common/css/cover.css'
import CommonJs from './common/js/common.js'
import './common/js/module.js'
import format from './common/js/format.js'
Vue.prototype.fmt = format

Vue.config.productionTip = false

// axios改用this.$http调用
Vue.prototype.$http = axios
// 默认请求路径，每个页面用this.url调用
//Vue.prototype.url = 'http://219.144.95.230:8880/CAMPAPI/' 
Vue.prototype.url = 'http://192.168.1.229:8084/'
//Vue.prototype.url = 'http://192.168.1.126:8084/' 
//Vue.prototype.url = 'http://192.168.1.107:8084/'
Vue.prototype.pic = 'http://192.168.1.126:8084/file/upload'
//Vue.prototype.picurl = 'http://192.168.1.126:8080'


// 添加webtoken
axios.interceptors.request.use(function (config) {
  // 在请求发出之前进行一些操作
  if (localStorage.webtoken) {
    config.headers.common['CampToken'] = localStorage.webtoken
  }
  return config
}, function (err) {
  // Do something with request error
})
// 添加一个响应拦截器
axios.interceptors.response.use(function (res) {
  // 在这里对返回的数据进行处理
  return res
}, function (err) {
  // Do something with response error
})

// 按钮权限
Vue.prototype.showBtn = function(btnName) {
    var count = localStorage.getItem("btn_autho").indexOf(btnName)
    if (count == -1) {
        return false;
    } else {
        return true;
    }
}

// vue引用
Vue.use(iView)
Vue.use(VueQuillEditor)
Vue.use(VueAxios, axios)
Vue.use(ElementUI)


/* eslint-disable no-new */
global.vm = new Vue({
    el: '#app',
    router,
    template: '<App/>',
    components: { App }
})
